import request from "@/utils/request";

// 获取合同列表
export function getContractListApi(query, data) {
  return request({
    url: "/system/contract/list",
    method: "post",
    params: query,
    data,
  });
}

// 获取合同审核列表
export function getContractCheckListApi(query, data) {
  return request({
    url: "/system/contract/selectCheckContractList",
    method: "post",
    params: query,
    data,
  });
}

// 获取项目列表
export function getProjectHaveListApi(contractId) {
  return request({
    url: `/system/contract/selectProjectByIdList`,
    method: "get",
    params: { contractId },
  });
}

// 获取原合同列表
export function getoldContractListApi(query, data) {
  return request({
    url: `/system/contract/selectOldContractList`,
    method: "post",
    params: query,
    data,
  });
}
// 获取项目列表
export function getProjectListApiSec(contractId) {
  return request({
    url: `/system/contract/selectProList`,
    method: "get",
    params: { contractId },
  });
}

// 获取客户列表
export function getCustomerListApi(userId) {
  return request({
    url: `/system/contract/queryCustomerByUserIdList`,
    method: "get",
    params: { userId },
  });
}

// 新增合同
export function addContract(data) {
  return request({
    url: "/system/contract/add",
    method: "post",
    data,
  });
}

// 编辑合同
export function editContract(data) {
  return request({
    url: "/system/contract/edit",
    method: "post",
    data,
  });
}

// 编辑合同
export function cancelContract(data) {
  return request({
    url: "/system/contract/cancel",
    method: "post",
    data,
  });
}


// 获取合同详情
export function getContractDetailApi(contractId) {
  return request({
    url: "/system/contract/getInfo",
    method: "get",
    params: { contractId },
  });
}

// 删除合同
export function deleteContractApi(contractId) {
  return request({
    url: `/system/contract/remove`,
    method: "get",
    params: { contractId },
  });
}

// 提交
export function checkContractApi(data) {
  return request({
    url: "/system/contract/check",
    method: "post",
    data,
  });
}

// 新增合同实际收款
export function addContractMoney(data) {
  return request({
    url: "/system/actualMoney/addAndEdit",
    method: "post",
    data,
  });
}

// 审核进度
export function selectAuditList(deliveryApplyId) {
  return request({
    url: `/system/contract/selectAuditList`,
    method: "get",
    params: { deliveryApplyId },
  });
}
